/* ***************************************************** */
/* Arcans Team (2010), website                           */
/* Site under GNU GPL v3 Licence                         */
/* (see NOTICE and COPYING in the of the site file tree) */
/* ***************************************************** */

/* ***************************************************** */
/* variables globales                                    */
/* ***************************************************** */
var reload_timer;
/* ***************************************************** */
/* fonction initFun, lancement des scripts               */
/* ***************************************************** */
function initSession () { reload_timer = window.setTimeout("decon.prev();",1500000); doc.body.addEventListener("click",rcfun,false); }
function rcfun () { window.clearTimeout(reload_timer); reload_timer = window.setTimeout("decon.prev();",1500000); }
/* ***************************************************** */
/* module de déconnexion                                 */
/* ***************************************************** */
var decon = (function () {
	function prev () {
		if (voile.voile_S_in().style.display == "block") {
			if (voile.voile_S_in().byTAG("progress") == []) { ajax.abort(); } voile.initSclose(1,"encart_prev"); }
		else if (voile.voile_ex().style.display == "block") voile.initSclose(1,"encart_prev");
		else voile.initSaff(1,"encart_prev");
		reload_timer = window.setTimeout("decon.decomp(30);",2000);
	}
	function decomp (delai) {
		var texte = "";
		if (delai == 1) { texte = "1 seconde"; reload_timer = window.setTimeout("decon.effect(1);",1000); }
		else { texte = delai + " secondes"; reload_timer = window.setTimeout("decon.decomp("+(delai-1)+");",1000); }
		voile.modElt(doc.byID("sec_decon_span"),{"texte":texte});
	}
	function effect (choix) {
		var delai = 0;
		if (choix) { voile.initSclose(1,"encart_prev","encart_decon"); delai = 4700; }
		else { voile.initSaff(1,"encart_decon"); delai = 2800; }
		ajaxFun("decon","",""); window.setTimeout("voile.initSclose(2,'encart_decon');",delai);
		window.setTimeout("location.replace('"+absolute_path+"index');",delai + 900);
	}
	return {
		prev: function () { prev(); },
		decomp: function (delai) { decomp(delai); },
		effect: function (choix) { effect(choix); }
	}
})();